# # 列表
# name = ["zhangsan", 14, 3.14, "zhaoqi"]
# print(name)
# 不局限于字符，什么都可以放

# name = ["zhangsan", "lisi"]
# name.append("wangwu")
# print(name)
# name.append("zhaoliu")
# print(name)

# # extend
# name = ["zhangsan", "lisi"]
# number = [14,3.14]
# name.extend(number)
# print(name)
# 用来结合列表


# insert
# name = ["zhangsan", "lisi"]
# name.insert(1, 3.1415926)
# print(name)
# 插入

# 列表嵌套
# name = ["zhangsan", "lisi"]
# number = [3.14,520]
# name.insert(1, number)
# print(name)
# name[1][1] = 1314
# print(name)

# 删除
# name = ["zhangsan", "lisi"]
# del name
# print(name)

# name = ["zhangsan", "lisi"]
# ret = name.pop()
# print(ret)
# # 默认删除最后一个

# name = ["zhangsan", "lisi"]
# name.pop(0)
# print(name)

# remove
# name = ["zhangsan", "lisi", "wangwu","lisi"]
# name.remove("lisi")
# print(name)
# 默认删除第一个想要的东西


# number = [3.14, 12345, 520]
# number.clear()
# print(number)

# name = ["zhangsan", "lisi", "wangwu"]
# name[1] = "修改的名字"
# print(name)
# 查找  ---index and countddddd
# name = ["zhangsan", "lisi", "wangwu", "zhaoliu","lisi"]
# # ret = name.index("lisi")
# # name[ret] = "wow"
# # print(name)
# print(name.count("lisi"))

# # 字符函数 strip函数
# char = input("请输入：")
# ret = char.strip()
# print(ret)
# strip函数就是去掉两边的空格
# char1 = "hello "
# char2 = "Pythom"
# char3 = "!!!"
# print(char1 + char2 + char3)

# str1 = "北京，上海，浙江"
# ret = str1.split(",")
# print(ret)

# str1 = "山东，浙江，广东，江苏"
# print(str1.split(","))
# split函数的返回值是一个列表，但是作用对象是字符

# 连接列表 --- join
# str_list = ["apple", "banana", "orange"]
# ret = "/".join(str_list)
# print(ret)

# str_list = ["北京","上海","天津"]
# ret = "@".join(str_list)
# print(ret)
# join and spilt 正好反着来
# spilt --- 字符
# join --- 列表

# 寻找  ---  find and index
# str1 = "zhangsan lisi wangwu zhaoliu"
# ret = str1.find("lisi")
# ret = str1.find("lisi  ")
# print(ret)
# 找的到返回它的索引值，找不到就返回-1

# str1 = "zhangsan lisi wangwu zhaoliu"
# ret = str1.index("lisi")
# ret = str1.index("l isi")
# print(ret)

# find and index 返回的是索引值，find找不到返回-1，index找不到返回报错

# str1 = "zhangsan lisi wangwu lisi lisi"
# ret = str1.count("lisi")
# print(ret)
# count记录个数

# replace
# char = "zhangsan lisi wangwu lisi lisi"
# ret = char.replace("lisi","coco",2)
# print(char)
# print(ret)
# replace改变全改变，除非给个数
# 改变会生成新的值，不会改变原先的量

# and or not
# in 用来判断这个东西是否在其中
# char = "zhangsan lisi wangwu zhaoliu"
# print("lisi  " in char)

# 三种语句
# 顺序语句 判断语句 循环语句

# 列表
# 列表中可以放不同种类的值
# list = ["zhangsan", 3.14, 520, ["lisi"]]
# print(list)

# append  extend  insert
# s = ["zhangsan", 3.14, 520]
# s.append("lisi")
# print(s)

# append 在最后加上所需内容
#
# list1 = ["zhnagsan","lisi"]
# list2 = ["wangwu","zzhaoliu"]
# list2.extend(list1)
# print(list2)

# extend在最后扩充另一个列表

# list1 = ["apple", "banana", "orange"]
# list1.insert(1,"花姑娘")
# print(list1)
# insert插入一个值在列表中

# del操作
# list1 = ["zhangsan","lisi","wangwu"]
# del list1
# print(list1)
# del就是彻底删除了
# pop remove
# list1 = ["zhangsan","lisi","wangwu"]
# ret = list1.pop()
# print(ret)
# 不填默认最后一个，里面可以填写索引的值

# list1 = ["zhangsan", "lisi", "wangwu"]
# list1.remove("lisi")
# print(list1)

# clear
# list1 = ["zhangsan", "lisi", "wangwu"]
# list1.clear()
# print(list1)
# clear是真给你清除了

# 查改
# list1 = ["zhangsan", "lisi", 3.14, ["wangwu", 12345]]
# list1[1] = "coco"
# print(list1)
# list1[3][1] = "zzz"
# print(list1)

# name = ["zhangsan", "lisi", "wangwu", "zhaoliu"]
# ret = name.index("wangwu")
# name[ret] = "coco"
# print(name)

# 切片
# list1 = ["apple", 3.14, 520, "lisi"]
# ret1 = list1[0:2]
# ret2 = list1[-3:-1]
# ret3 = [::-1]
# print(ret1)
# print(ret2)
# print(ret3)
# 前省略为0，后省略为最后一个

# 排序  ---  sort
# list1 = ["zhangsan", "lisi", "apple", "APP"]
# num_list = [1, 3, 6, 4, 9, 10, 3.14, 4.67,]
# num_list.sort()
# list1.sort()
# print(list1)
# print(num_list)
#
# 反转  --- reverse
# num_list = [1, 4, 2, 5, 76, 3.1415926]
# num_list.reverse()
# print(num_list)


# 列表循环
# num_list = [1, 2, 3, 4, 5, 7, 2, 67, 24, 5, 14, 58]
# for i in num_list:
#     print(i)

# name_list = ["zhangsan", "lisi", "wangwu", "zhaoliu"]
# for i in name_list:
#     print(i)

# if 条件 ：
# if else:
# elif:
# while 条件 ：
# for i in range():

# 字典
# dic = \
#     {
#         "name": ["zhangsan", 19],
#         22: ["lisi"],
#         "coco": 123456789
#     }
# print(dic["coco"])
# 目前只能是字符和数字
# name = input("Enter your name: ")
# age = int(input("Enter your age: "))
# print(f"Your name is {name} and your age is {age}")

# key_value结构
